package fifth.Method;

public class GetByte {
    /*
    字符串与byte字节数组的转换
     */

    public static void main(String[] args) {
        String s = "abcdef";
        byte [] b= s.getBytes();//将字符串变为字节数组
        System.out.println(new String(b));//将字节数组转换成字符串
        System.out.println(new String(b,0,3));//将部分字节数组变为字符串

    }
}
